<?php


declare(strict_types=1);

namespace App\Controller\Abell;

use App\Controller\AbstractController;
use App\Model\Wxdata as WxdataModel;
use App\Utils\ApiUtils;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\RequestMapping;
use Hyperf\Redis\Redis;
use Hyperf\Utils\ApplicationContext;

/**
 * @Controller()
 */
class RedisController extends AbstractController
{
    /**
     * REDIS 列表数据展示
     * Abell 2020/5/13
     * @RequestMapping(path="/abell/redis/list", methods="get")
     */
    public function list(){
        $container = ApplicationContext::getContainer();
        $redis = $container->get(Redis::class);
        $result = $redis->keys('*');
        $result_array = array();
        foreach ($result as $res_data) {
//            array_push($result_array,$redis->get($res_data));
            $result_array[$res_data] = $redis->get($res_data);
            // 删除所有redis数据
//            $redis->del($res_data);
        }
        return $result_array;
    }





}